<!--
 * @Author: 鱿鱼溪学院
 * @Date: 2024-10-07 11:02:19
 * @LastEditTime: 2024-10-08 00:21:34
 * @LastEditors: 鱿鱼溪学院
 * @Description: 章节弹出组件
 * @FilePath: \yyx-play\src\components\lesson\ChapterList.vue
 * Copyright 鱿鱼溪学院 by edu v1.0
 * 天道酬勤
-->

<template>
  <div class="chapter" ref="chapterBox" v-if="chapterVisible" style="">
    <div class="chapter-box">
      <dl style="">
        <dt class="title">
          <span class="chapter-text"> 第1章 课程介绍(了解本课程必看) </span>
        </dt>
        <dd class="lesson">
          <span class="lesson-text" style="cursor: pointer">
            <el-icon class="icon" size="17"><VideoCamera /></el-icon>
            1-1 标准化大厂编程规s 1-1 标准化大厂编程规s 1-1
            标准化大厂编程规ssdsd
          </span>
        </dd>

        <dd class="lesson">
          <span class="lesson-text">
            <el-icon class="icon" size="17"><VideoCamera /></el-icon>
            1-2 课程脑图
          </span>
        </dd>
        <dd class="lesson">
          <span class="lesson-text">
            <el-icon class="icon" size="17"><VideoCamera /></el-icon>
            1-1 标准化大厂编程规s 1-1 标准化大厂编程规s 1-1
            标准化大厂编程规ssdsd
          </span>
        </dd>
        <dt class="title" style="height: 24px; margin-top: 24px">
          <span class="chapter-text"> 第2章 课程介绍(了解本课程必看) </span>
        </dt>
        <dd class="lesson">
          <span class="lesson-text">
            <el-icon class="icon" size="17"><VideoCamera /></el-icon>
            1-1 标准化大厂编程规s 1-1 标准化大厂编程规s 1-1
            标准化大厂编程规ssdsd
          </span>
        </dd>

        <dd class="lesson">
          <span class="lesson-text">
            <el-icon class="icon" size="17"><VideoCamera /></el-icon>
            1-2 课程脑图
          </span>
        </dd>
        <dd class="lesson">
          <span class="lesson-text">
            <el-icon class="icon" size="17"><VideoCamera /></el-icon>
            1-1 标准化大厂编程规s 1-1 标准化大厂编程规s 1-1
            标准化大厂编程规ssdsd
          </span>
        </dd>
      </dl>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
const chapterVisible = ref(false);

//初始化方法
const showAndInit = () => {
  chapterVisible.value = !chapterVisible.value;
};

//关闭窗口方法
const closeBox = () => {
  chapterVisible.value = false;
};

defineExpose({
  showAndInit,
  closeBox,
});
</script>

<style lang="less" scoped>
.chapter {
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  height: 100%;
  background-color: #26292c;
  opacity: 0.9;
  z-index: 9;
}
.chapter-box {
  height: 100%;
  padding: 0 24px;
  dl {
    color: #fff;
    margin-top: 18px;
    dt {
      height: 24px;
      margin-top: 24px;
    }
  }
  .chapter-text {
    display: inline-block;
    max-width: 260px;
    // 不换行
    white-space: nowrap;
    overflow: hidden;
    //显示省略号
    text-overflow: ellipsis;

    vertical-align: middle;
    line-height: 22px;
    font-size: 14px;
    color: #fff;
    font-weight: 700;
  }
  dd.lesson {
    padding-left: 9px;
    height: 30px;
    line-height: 30px;
    .icon {
      display: inline-block;
      position: relative;
      top: 4px;
    }
    span {
      display: inline-block;
      width: 100%;
      font-size: 12px;
      // border: 1px solid red;
      //看过课程此颜色
      //  color: rgba(255, 255, 255, 0.7);
      color: #fff;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      vertical-align: middle;
    }
  }
}
</style>
